void swap(int *a, int *b) {
    int temp = *a;
    *a = *b;
    *b = temp;
    
}
int getpiviot(int *num, int begin, int end) {
    int i = 0;
    int j = 0;
    int t = num[end];
    
    while (j < end) {
        if (num[j] <= t) {
            swap(&num[i], &num[j]);
            i++;
        }
        j++;
    }
    swap(&num[i], &num[end]);
    return i;
}

void qsort_c(int *num, int begin, int end) {
    if (begin >= end) {
        return;
    }
    
    int piviot = getpiviot(num, begin, end);
    qsort_c(num, begin, piviot - 1);
    qsort_c(num, piviot + 1, end);
}
